<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
  <title>Single page app using Polymer</title>
  <script src="/webcomponents.min.js"></script>
  <!-- vulcanized version of imported elements --
       see "elements.html" for unvulcanized list of imports. -->
  <link rel="import" href="vulcanized.html">
  <link rel="stylesheet" href="styles.css" shim-shadowdom>
</head>
<body unresolved fullbleed>

<template is="auto-binding" id="t">

  <!-- Route controller. -->
  <flatiron-director route="{{route}}" autoHash></flatiron-director>

  <!-- Keyboard nav controller. -->
  <core-a11y-keys id="keys" target="{{parentElement}}"
                  keys="up down left right space space+shift"
                  on-keys-pressed="{{keyHandler}}"></core-a11y-keys>

  <core-scaffold id="scaffold">

    <nav>
      <core-toolbar>
        <span>Single Page Polymer</span>
      </core-toolbar>
      <core-menu valueattr="hash" selected="{{route}}" selectedModel="{{selectedPage}}"
                 on-core-select="{{menuItemSelected}}">
        <template repeat="{{page, i in pages}}">
          <paper-item hash="{{page.hash}}" noink>
            <core-icon icon="label{{route != page.hash ? '-outline' : ''}}"></core-icon>
            <a href="#{{page.hash}}">{{page.name}}</a>
          </paper-item>
        </template>
      </core-menu>
    </nav>

    <core-toolbar tool flex>
      <div flex>{{selectedPage.page.name}}</div>
      <core-icon-button icon="refresh"></core-icon-button>
      <core-icon-button icon="add"></core-icon-button>
    </core-toolbar>

    <div layout horizontal center-center fit>
      <core-animated-pages id="pages" selected="{{route}}" valueattr="hash"
                           transitions="slide-from-right"
                           on-tap="{{cyclePages}}">
        <template repeat="{{page, i in pages}}">
          <section hash="{{page.hash}}" layout vertical center-center>
            <div>{{page.name}}</div>
          </section>
        </template>
      </core-animated-pages>
    </div>

  </core-scaffold>

</template>

<script src="app.js"></script>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-43475701-2', 'auto'); // ebidel's
  ga('create', 'UA-39334307-1', 'auto'); // pp.org
  ga('send', 'pageview');
</script>
</body>
</html>
